/*
 * Copyright (c) 2015. For Intelligent Group.
 */

package com.intelligent.ispc.utils;

/**
 * Created by Julia.Zhou on 2016/03/12.
 */
public enum TestFileStatus {
    PROCESSING(1, "PROCESSING"),
    DONE(2, "DONE");

    private int index;
    private String code;

    TestFileStatus(int index, String code) {
        this.code = code;
        this.index = index;
    }

    public static TestFileStatus getValueOf(String code) {
        if (PROCESSING.getCode().equals(code)) {
            return PROCESSING;
        } else if (DONE.getCode().equals(code)) {
            return DONE;
        } else {
            return null;
        }
    }

    public static TestFileStatus getValueOf(int index) {
        switch (index) {
            case 1:
                return PROCESSING;
            case 2:
                return DONE;
            default:
                return null;
        }
    }

    public String getCode() {
        return code;
    }

    public int getIndex() {
        return index;
    }
}
